<?php
class user_model extends CI_Model{
	
	function register_user($password, $fname, $lname, $email, $location, $company, $dob)
	{
		//input user into user
		
		//encrypted password
		$sha1_password = sha1($password);
		
		//$query_str = "INSERT INTO user (user_password, user_firstname, user_surname, user_email, user_location, user_company, user_dob) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
		
		$data = array(
   			'user_password' => $sha1_password,
   			'user_firstname' => $fname ,
   			'user_surname' => $lname ,
   			'user_dob' => $dob,
   			'user_email' => $email,
   			'user_location' => $location,
   			'user_organisation' => $company
   			
		);
		
		
		//insert to db
		$this->db->insert('user', $data);
		
		//set user session then redirect to profile page
		/*$_SESSION['userObject'] = getUserByUsername($email);
		$_SESSION['username'] = $_POST['username'];
		redirect('mainpage');*/
		
	}
	
	//function get_user_by_email()
}


?>
